/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.flowumi.controladores.admin;

import com.flowumi.controladores.SessionFlowumiUtilBean;
import com.flowumi.controladores.SessionFlowumiUtilBean;
import com.flowumi.dto.Curso;
import com.flowumi.facade.AdminFacade;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.Dependent;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author ideacentre
 */
@ManagedBean
@ViewScoped
public class AdminListaCursosBean {
private static final org.apache.log4j.Logger LOGGER =
            org.apache.log4j.Logger.getLogger(AdminListaCursosBean.class);
    @EJB
    AdminFacade adminFacade;
    
    @ManagedProperty("#{sessionFlowumiUtil}")
    private SessionFlowumiUtilBean sessionFlowumiUtilBean;
    
    private List<Curso> cursos;
    /**
     * Creates a new instance of AdminListaCursosBean
     */
    public AdminListaCursosBean() {
    }
    
    @PostConstruct
    public void init() {
        ObtenerCursos();
    }
    
    public List<Curso> getCursos() {
        return cursos;
    }

    public void setCursos(List<Curso> cursos) {
        this.cursos = cursos;
    }

    public void ObtenerCursos(){
        cursos = adminFacade.ObtenerCursos();
    }
    
    public void setSessionFlowumiUtilBean(SessionFlowumiUtilBean sessionFlowumiUtilBean) {
        this.sessionFlowumiUtilBean = sessionFlowumiUtilBean;
    }
    
    public String verDetalleCurso(long idCurso){
        sessionFlowumiUtilBean.setCodigoAdminCursoDetalle(idCurso);
        return "AdminDetalleUsuario";
    }
}
